 package com.nondo.dean.order.common;

import java.text.SimpleDateFormat;
import java.util.Date;

 public class OrderUtils {
     
     private static final String PREFIX = "CG";
     
     private static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmssSSS";

    public static void main(String[] args) {
        System.out.println(generateOrderCode());
    }

    private static Date getDate() {
        return new Date();
    }
    
    /**
     * 采购订单号
     * @return 形如：CG20180419113430615
     */
    public static String generateOrderCode () {
        SimpleDateFormat sdf = new SimpleDateFormat(YYYYMMDDHHMMSS);
        String orderCode = PREFIX + sdf.format(getDate());
        return orderCode;
    }

}
